class MinStack:

    def __init__(self):
        """
        initialize your data structure here.
        """
        self.stack = []
        self.order = []

    def push(self, x: int) -> None:
        self.stack.append(x)
        if len(self.order) == 0:
            self.order.append(x)
            return
        if x <= self.order[-1]:
            self.order.append(x)

    def pop(self) -> None:
        x = self.stack.pop()
        if self.order[-1] == x:
            self.order.pop()

    def top(self) -> int:
        return self.stack[-1]

    def getMin(self) -> int:
        return self.order[-1]


if __name__ == '__main__':
    # Your MinStack object will be instantiated and called as such:
    obj = MinStack()
    obj.push(1)
    obj.push(3)
    obj.push(2)
    obj.push(-1)
    obj.push(0)
